import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
file ="file:///" + os.path.abspath("html2") + "/注册实例.html"
driver.get(file)
# # 注册用户
# # 定位账号输入框
# time.sleep(2)
# driver.find_element(By.ID, "user").send_keys("kkkk哈哈")
# # 定位密码输入框
# time.sleep(2)
# driver.find_element(By.ID, "password").send_keys(123456)
# # 定位手机号输入框
# time.sleep(2)
# driver.find_element(By.ID, "tel").send_keys(19850225333)
# # 定位邮箱输入框
# time.sleep(2)
# driver.find_element(By.ID, "email").send_keys("45666@qq.com")
# # 点击注册用户按钮
# time.sleep(2)
# driver.find_element(By.TAG_NAME, "button").click()
# # 退出
# driver.quit()

# A 用户注册
'''
A = driver.find_element(By.ID, "idframe1")
driver.switch_to.frame(A)
# 定位账号A注册框
driver.find_element(By.ID, "userA").send_keys("haha哈哈")
# 定位用户A密码输入框
time.sleep(2)
driver.find_element(By.ID, "passwordA").send_keys(456789)
# 定位用户A手机号输入框
time.sleep(2)
driver.find_element(By.ID, "telA").send_keys(15269994222)
# 定位用户A邮箱输入框
time.sleep(2)
driver.find_element(By.ID, "emailA").send_keys("4555233@qq.com")
# 定位注册A按钮并点击
time.sleep(2)
driver.find_element(By.TAG_NAME, "button").click()
driver.quit()
'''
# B表注册
driver.switch_to.default_content()   # 切回主页面
B = driver.find_element(By.NAME, "myframe2")
driver.switch_to.frame(B)
# 定位用户B账号输入框
driver.find_element(By.ID, "userB").send_keys("dd天天开心")
time.sleep(2)
driver.find_element(By.ID, "passwordB").send_keys(789456123)
time.sleep(2)
driver.find_element(By.ID, "telB").send_keys(12200012333)
time.sleep(2)
driver.find_element(By.ID, "emailB").send_keys("4566677@qq.com")
time.sleep(2)
driver.find_element(By.TAG_NAME, "button").click()
driver.quit()





